package com.base.logistics.jdl.bean.trace;

import com.base.logistics.jdl.util.json.JdlGsonBuilder;
import com.base.logistics.jdl.bean.RequestParams;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <pre>
 * 查询物流轨迹（给消费者）请求对象
 * </pre>
 * @since 2021-02-19
 */
public class GetWaybill2CTraceByWaybillCodeRequestParams extends RequestParams   implements Serializable {

    /**
     * 服务域
     */
    private static final String LOP_DN= "express";

    /**
     * code字段
     */
    private static final String CODE_FIELD = "statusCode";

    /**
     * 成功状态码
     */
    private static final Integer SUCCESS_CODE = 0;

    /**
     * API url
     */
    private static final String METHOD = "/Waybill2CTraceApi/getWaybill2CTraceByWaybillCode";

    /**
     * 查询物流轨迹对象
     * <pre>
     * 是否必填：是
     * </pre>
     */
    private Waybill2cTraceDTO waybill2cTraceDto;

    GetWaybill2CTraceByWaybillCodeRequestParams(Waybill2cTraceDTO waybill2cTraceDto) {
        this.waybill2cTraceDto = waybill2cTraceDto;
    }

    public static GetWaybill2CTraceByWaybillCodeRequestParamsBuilder builder() {
        return new GetWaybill2CTraceByWaybillCodeRequestParamsBuilder();
    }

    /**
     * 获取返回状态码字段
     * @return 返回状态码字段
     */
    @Override
    public String getCodeField() {
        return CODE_FIELD;
    }

    /**
     * 获取成功返回状态码
     * @return 成功返回状态码
     */
    @Override
    public Integer getSuccessCode() {
        return SUCCESS_CODE;
    }

    /**
     * 获取请求json数据
     * @return 请求json数据
     */
    @Override
    public String getJsonParams() {
        List<Waybill2cTraceDTO> list = new ArrayList<>();
        list.add(this.waybill2cTraceDto);
        return JdlGsonBuilder.create().toJson(list);
    }

    /**
     * 获取服务域
     * @return 服务域
     */
    @Override
    public String getLopDn(){
        return LOP_DN;
    }

    /**
     * 获取API url
     * @return API url
     */
    @Override
    public String getMethod(){
        return METHOD;
    }

    public Waybill2cTraceDTO getWaybill2cTraceDto() {
        return this.waybill2cTraceDto;
    }

    public void setWaybill2cTraceDto(Waybill2cTraceDTO waybill2cTraceDto) {
        this.waybill2cTraceDto = waybill2cTraceDto;
    }

    public String toString() {
        return "GetWaybill2CTraceByWaybillCodeRequestParams(waybill2cTraceDto=" + this.getWaybill2cTraceDto() + ")";
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof GetWaybill2CTraceByWaybillCodeRequestParams)) return false;
        final GetWaybill2CTraceByWaybillCodeRequestParams other = (GetWaybill2CTraceByWaybillCodeRequestParams) o;
        if (!other.canEqual((Object) this)) return false;
        if (!super.equals(o)) return false;
        final Object this$waybill2cTraceDto = this.getWaybill2cTraceDto();
        final Object other$waybill2cTraceDto = other.getWaybill2cTraceDto();
        if (this$waybill2cTraceDto == null ? other$waybill2cTraceDto != null : !this$waybill2cTraceDto.equals(other$waybill2cTraceDto))
            return false;
        return true;
    }

    protected boolean canEqual(final Object other) {
        return other instanceof GetWaybill2CTraceByWaybillCodeRequestParams;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = super.hashCode();
        final Object $waybill2cTraceDto = this.getWaybill2cTraceDto();
        result = result * PRIME + ($waybill2cTraceDto == null ? 43 : $waybill2cTraceDto.hashCode());
        return result;
    }

    public static class GetWaybill2CTraceByWaybillCodeRequestParamsBuilder {
        private Waybill2cTraceDTO waybill2cTraceDto;

        GetWaybill2CTraceByWaybillCodeRequestParamsBuilder() {
        }

        public GetWaybill2CTraceByWaybillCodeRequestParamsBuilder waybill2cTraceDto(Waybill2cTraceDTO waybill2cTraceDto) {
            this.waybill2cTraceDto = waybill2cTraceDto;
            return this;
        }

        public GetWaybill2CTraceByWaybillCodeRequestParams build() {
            return new GetWaybill2CTraceByWaybillCodeRequestParams(waybill2cTraceDto);
        }

        public String toString() {
            return "GetWaybill2CTraceByWaybillCodeRequestParams.GetWaybill2CTraceByWaybillCodeRequestParamsBuilder(waybill2cTraceDto=" + this.waybill2cTraceDto + ")";
        }
    }
}
